<extend name="Login:layout"/>

<block name="mainr">

                <h3 class="Header"></h3>

                <div id="logArea">
                    <div class="Error">
                        <div class="NoteError"></div>
                    </div>
                    <form id="loginForm" method="post" action="">
                        <table class="loginTable">

                            <tr>
                                <th>员工编号</th>
                                <td><input type="text" id="username" name="username" class="input" value="" /></td>
                                <td>

                                </td>
                            </tr>

                            <tr>
                                <th>密　码</th>
                                <td>
                                    <input type="password" id="password" name="password" class="input" autocomplete="off" value="" />
                                </td>
                                <td>&nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="3" id="loginResult" style="color: red;">
                                    
                                </td>
                            </tr>

                            <tfoot>
                                <tr>
                                    <td></td>
                                    <td colspan="2" >
                                        <button id="btnLogin" type="button" class="Button">
                                            登　录
                                        </button>
                                        <button type="button" id="btnRegist" class="Button" onclick="location.href='{:U(registPage)}'">
                                            注  册 
                                        </button>

                                        <a href="#" onclick="forgetPwd();">
                                            忘记密码？
                                        </a>

                                    </td>
                                </tr>
                                <tr>
                                    <td colspan='3'>
                                        
                                    </td>
                                </tr>
                            </tfoot>
                            
                        </table>
                    </form>

                </div>
</block>


<block name="customjs">
    <script>
        function forgetPwd(){
            
            var username = $.trim($("#username").val());
            
            if( username === ""){
                alert("请先输入用户名！");
                $("#username").focus();
                return;
            }
            
            var sendData = {
                "username" : username
            };
            
            $.post("{:U(forgetPwd)}", sendData).done(function(responseData){
                if (responseData.status === 1) {
                        alert(responseData.info);
                        location.href = responseData.jumpUrl;
                    } else {
                        alert(responseData.info);
                    }
            });
            
        }
    </script>
    
    <script>
        $(function(){
           
           $("#btnLogin").click(function(){
               //alert("333");
               
               var username = $.trim($("#username").val());
               var password = $.trim($("#password").val());
               
                if( username === "" || password === ""){
                    alert("请先输入用户名或密码！");
                    return;
                }
               
               var sendData = {
                   "username" : username,
                   "password" : password
               };
               
               $.post("{:U(runLogin)}", sendData).done(function(responseData){
                   if(responseData.status === 1){
                        $("#loginResult").text(responseData.info);
                        location.href = responseData.jumpUrl;
                    }else{
                        $("#loginResult").text(responseData.info);
                    }
               });
           });
           
        });
    </script>
</block>